package com.hbnu.iostream;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

public class WriterDemo1 {
    public static void main(String[] args) {
        String path = "C:" + File.separator +"Users" + File.separator +"TX" + File.separator +"IdeaProjects" + File.separator +"javalean" + File.separator +"src" + File.separator +"com" + File.separator +"hbnu" + File.separator +"iostream" + File.separator +"test.txt";

        File file = new File(path);
        try {
            Writer out = new FileWriter(file);
            String content = "通过字符输出流将内容输出到指定文件中";
            out.write(content);
            out.close();
        }
        catch (IOException e){
            throw new RuntimeException(e);
        }
    }
}
